package cn.kgc.service.impl;

import cn.kgc.pojo.Blog;
import cn.kgc.dao.BlogDao;
import cn.kgc.service.BlogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 项目名：project0926
 * 创建人：君忆zm
 * 创建时间：2019/10/18-14:47
 */
@Service("blogService")
public class BlogServiceImpl implements BlogService {
    @Resource
    BlogDao blogDao;

    public BlogDao getBlogDao() {
        return blogDao;
    }

    public void setBlogDao(BlogDao blogDao) {
        this.blogDao = blogDao;
    }

    @Override
    public List<Blog> blogList(int userId) {
        return blogDao.blogList(userId);
    }
    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public int insertBlog(Blog blog) {
        return blogDao.insertBlog(blog);
    }

    @Override
    public int deleteBlog(int id) {
        return blogDao.deleteBlog(id);
    }
}
